<template>
  <div class="container" >
    <!-- 题目审核弹框 -->
    <el-form ref="form" :model="form" >
      <el-form-item>
        <el-radio v-model="form.a" :label="1">通过</el-radio>
        <el-radio v-model="form.a" :label="2">拒绝</el-radio>
      </el-form-item>
      <el-form-item>
        <el-input
          v-model="form.value"
          type="textarea"
          placeholder="请输入审核意见"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <div class="btn">
          <el-button @click="onCancel">取消</el-button>
          <el-button type="primary" @click="onSubmit">确认</el-button>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  name: 'QuestionsCheck',
  props: {
    checkID: {
      required: true
    }
  },
  data () {
    return {
      form: {
        a: 1,
        value: ''
      }
    }
  },
  methods: {
    //   取消
    onCancel () {
      this.$emit('close')
    },
    //   确认
    async onSubmit () {
      // 文本框没有值,提示
      if (!this.form.value) {
        return this.$message({
          message: '请输入审核意见',
          type: 'warning'
        })
      }
      const res = await choiceCheck({
        id: this.checkID,
        chkState: this.form.a,
        chkRemarks: this.form.value
      })
      if (res.data.success) this.$message.success('操作成功')
      this.$emit('close')
    }
  }
}
</script>

<style scoped >

.btn{
    margin-left: 230px;
}
.el-radio {
  display: inline-block;
}
</style>
